package com.jic.manager.controller.manage.memstorecontroller;

import com.jic.common.base.vo.RestResult;
import com.jic.manager.entity.MestoreAddress;
import com.jic.manager.service.MestoreAddressService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/*
 * 店铺地址维护
 * @autho zs
 * */
@RestController
@RequestMapping("/storeAddress")
public class MemStoreAddressController {
    @Autowired
    private MestoreAddressService memStoreAddressService;

    //新增修改店铺地址
    @PostMapping(value = "/saveAddressInfo")
    public RestResult<String> saveAddressInfo(@RequestBody MestoreAddress mestoreAddress){
        return memStoreAddressService.saveAddressInfo(mestoreAddress);
    }

    //查询店铺地址列表
    @PostMapping(value = "/getAddressList")
    @ResponseBody
    public RestResult<List<MestoreAddress>> queryList(@RequestBody MestoreAddress memStoreAddress){

        List<MestoreAddress> addressList = memStoreAddressService.query(memStoreAddress);
        return RestResult.success(addressList);
    }

   //删除店铺列表
    @PostMapping(value = "/deleteAddressInfo")
    @ResponseBody
    public RestResult<String> deleteAddressInfo(@RequestBody MestoreAddress mestoreAddress){
        return memStoreAddressService.deleteAddressInfo(mestoreAddress.getId());
    }
}
